STEP 6: Our sprites are in the same place! Let's create random x,y-coordinates to place our sprites.

  • Click the LOGIC tab in the toolkit, click and drag out Random Integer.
  • Change the variable name from my_var to emma_x.
  • Change the integers in the parentheses from 1,10 to -230, 230

This will create a random integer between -230 & 230 that we will use as Emma's x-coordinate.

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background("schoolentrance") stage.wait(2) stage.create_grid_overlay(50, "blue") stage.set_background_color("azure") emma = codesters.Sprite("person1") emma.set_size(0.5) michael = codesters.Sprite("person2") michael.set_size(0.5)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)